package com.wisdudu.blank.ui.setting.system;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.wisdudu.blank.R;
import com.wisdudu.blank.databinding.FragmentFeedbackBinding;
import com.wisdudu.frame.base.BaseFragment;

/**
 * Created by ypp on 2016/10/8.
 */
public class FeedBackFragment extends BaseFragment {
    private FragmentFeedbackBinding mBinding;

    @Override
    protected View initBinding(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_feedback, container, false);
        mBinding.setViewModel(new FeedBackVM(this));
        return mBinding.getRoot();
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initToolbar(getToolbar(), "意见反馈");
        mBinding.etContent.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                mBinding.tvNum.setText((140 - charSequence.length()) + "/140");
            }

            @Override
            public void afterTextChanged(Editable editable) {

            }
        });
    }
}
